//
//  LSZHotTopImagerViewCollCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/8/24.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZHotTopImagerViewCollCell.h"

@implementation LSZHotTopImagerViewCollCell
-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        CGFloat width = (ScreenWidth-40-50)/2;

        self.imageViewBack = [[UIImageView alloc]init];
        self.imageViewBack.frame = CGRectMake(0, 0,width, 80);
        self.imageViewBack.backgroundColor = [UIColor yellowColor];
        [self addSubview:self.imageViewBack];

        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.numberOfLines = 0;
        self.labelTitle.frame = CGRectMake(10, 10, self.imageViewBack.frame.size.width-20, self.imageViewBack.frame.size.height-20);
        self.labelTitle.textColor = [UIColor whiteColor];
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelTitle font:14.5];
        [self addSubview:self.labelTitle];
    }
    return self;
}
- (void)setListTopicsMg:(LSZListTopicsMg *)listTopicsMg
{
    [self.imageViewBack sd_setImageWithURL:[NSURL URLWithString:@""] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    self.labelTitle.text = [NSString stringWithFormat:@"#%@#",listTopicsMg.content];
    CGFloat sizeFont = [LSZSpecialPackaging initWithReturnsthesizeOf:14.5 :0.5];
    CGFloat height = [LSZSpecialPackaging caculateHeightOfText:self.labelTitle.frame.size.width height:self.imageViewBack.frame.size.height font:sizeFont :self.labelTitle.text]-5;
    CGRect rect = self.labelTitle.frame;
    rect.origin.y = (80-height)/2;//CGRectGetMaxY(self.imageViewBack.frame)-10-height;
    self.labelTitle.frame = rect;

}
@end
